ALTER TABLE S004.S004_T01029
 DROP PRIMARY KEY CASCADE;

DROP TABLE S004.S004_T01029 CASCADE CONSTRAINTS;

CREATE TABLE S004.S004_T01029
(
  EMDE_ID_NO           NUMBER,
  EMDE_DEPENDENT_ID    NUMBER,
  EMDE_DEPENDENT_NAME  VARCHAR2(150 BYTE),
  EMDE_BIRTHDATE       DATE,
  EMDE_GENDER          VARCHAR2(1 BYTE),
  EMDE_RELA_CODE       NUMBER,
  CREATED_BY           VARCHAR2(50 BYTE)        DEFAULT USER,
  DATE_CREATED         DATE                     DEFAULT SYSDATE,
  MODIFIED_BY          VARCHAR2(50 BYTE),
  DATE_MODIFIED        DATE,
  TRANNO               NUMBER
)
TABLESPACE HRIS
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            NEXT             1M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCOMPRESS 
NOCACHE
NOPARALLEL
MONITORING;

COMMENT ON TABLE S004.S004_T01029 IS 'EMPLOYEE DEPENDENTS TABLE';

COMMENT ON COLUMN S004.S004_T01029.EMDE_RELA_CODE IS 'REFER TO TABLE S004_T01031';


CREATE OR REPLACE TRIGGER S004."S004_T01029_BIU" 
before insert or update ON S004.S004_T01029 for each row
begin
  
   if inserting then
     select s004_t01029_sq01.nextval
     into   :new.tranno
     from   dual;

     :new.created_by    := user;
     :new.date_created  := sysdate;
   elsif updating then
     :new.modified_by   := user;
     :new.date_modified := sysdate;
   end if;
end;
/


DROP PUBLIC SYNONYM S004_T01029;

CREATE PUBLIC SYNONYM S004_T01029 FOR S004.S004_T01029;


ALTER TABLE S004.S004_T01029 ADD (
  PRIMARY KEY
 (TRANNO)
    USING INDEX 
    TABLESPACE HRIS
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
               ));

GRANT SELECT ON S004.S004_T01029 TO HRIS_ADMIN;

GRANT SELECT ON S004.S004_T01029 TO HRIS_VIEW;

GRANT SELECT ON S004.S004_T01029 TO PAYROLL_ADMIN;

GRANT DELETE, INSERT, SELECT, UPDATE ON S004.S004_T01029 TO S004_201_ENCODER;

GRANT SELECT ON S004.S004_T01029 TO S004_PROL_ADMIN;

GRANT SELECT ON S004.S004_T01029 TO S004_READ;

GRANT INSERT, SELECT, UPDATE ON S004.S004_T01029 TO S004_UPDATE;

